package com.sky.moduels.mini.controller;

import cn.hutool.extra.servlet.ServletUtil;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpMenuServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description: 菜单Controller
 * @ClassName: MiniMenuController
 * @Author: hupengming
 * @CreateTime: 2022-08-22 15:01
 */
@Slf4j
@RestController
@RequestMapping("/wx/menus")
public class MiniMenuController {

    @Autowired
    WxMpService wxMpService;

    @PostMapping("")
    public void addMenu(HttpServletRequest request) throws WxErrorException {

        String clientIP = ServletUtil.getClientIP(request);
        log.info("clientIP:{}",clientIP);

        String str = "";

        WxMpMenuServiceImpl wxMpMenuService = new WxMpMenuServiceImpl(wxMpService);
        wxMpMenuService.menuCreate(str);

    }


}
